/*****************************************************************************************
 * FILE NAME: app_protect                       COPYRIGHT (c) cos 2024
 * REVISION:  1.0.0                                     All Rights Reserved
 * DESCRIPTION:
 * =======================================================================================
 * UPDATE HISTORY:
 * REV      AUTHOR      DATE
 * v1.0.0   Tuxin       2024.10.14
 * DESCRIPTION OF CHANGE:
 ****************************************************************************************/
#ifndef __APP_PROTECT_H
#define __APP_PROTECT_H

//----------------------------------------------------------------------------------------
// @Project Includes
#include "typedefs.h"

//----------------------------------------------------------------------------------------
// @Global Macro Define in the module
#define CELL_VOLT_HIGH             	(3750U)
#define CELL_VOLT_LOW              	(1200U)
#define CURRENT_CALC_RATE           (10U)/*10 to mA*/

//----------------------------------------------------------------------------------------
// @Global Type defines in the module
typedef enum en_protect_state
{
    PROTECT_STATE_NO               	= 0U,
    PROTECT_STATE_YES              	= 1U,
} en_protect_state_t;

typedef struct stc_protect_var
{
    en_protect_state_t entov1Fg;
    uint16_t u16tovt1;
    uint16_t u16tovrt1;
    en_protect_state_t entov2Fg;	
    uint16_t u16tovt2;
    uint16_t u16tovrt2;
    en_protect_state_t entov3Fg;	
    uint16_t u16tovt3;
    uint16_t u16tovrt3;
	
    en_protect_state_t entuv1Fg;
    uint16_t u16tuvt1;
    uint16_t u16tuvrt1;
    en_protect_state_t entuv2Fg;	
    uint16_t u16tuvt2;
    uint16_t u16tuvrt2;
    en_protect_state_t entuv3Fg;	
    uint16_t u16tuvt3;
    uint16_t u16tuvrt3;
	
    en_protect_state_t enov1Fg;	
    uint16_t u16ovt1;
    uint16_t u16ovrt1;
    en_protect_state_t enov2Fg;		
    uint16_t u16ovt2;
    uint16_t u16ovrt2;
    en_protect_state_t enov3Fg;		
    uint16_t u16ovt3;
    uint16_t u16ovrt3;
		
    en_protect_state_t enuv1Fg;	
    uint16_t u16uvt1;
    uint16_t u16uvrt1;
    en_protect_state_t enuv2Fg;			
    uint16_t u16uvt2;
    uint16_t u16uvrt2;
    en_protect_state_t enuv3Fg;			
    uint16_t u16uvt3;
    uint16_t u16uvrt3;
		
    en_protect_state_t enocc1Fg;	
    uint16_t u16occt1;
    uint16_t u16occrt1;
    en_protect_state_t enocc2Fg;			
    uint16_t u16occt2;
    uint16_t u16occrt2;
    en_protect_state_t enocc3Fg;			
    uint16_t u16occt3;
    uint16_t u16occrt3;

    en_protect_state_t enocd1Fg;	
    uint16_t u16ocdt1;
    uint16_t u16ocdrt1;
    en_protect_state_t enocd2Fg;			
    uint16_t u16ocdt2;
    uint16_t u16ocdrt2;
    en_protect_state_t enocd3Fg;			
    uint16_t u16ocdt3;
    uint16_t u16ocdrt3;
		
    en_protect_state_t enscv3Fg;		
    uint16_t u16scvt3;
		uint16_t u16scvrt3;
		
    en_protect_state_t enotc1Fg;	
    uint16_t u16otct1;
    uint16_t u16otcrt1;
    en_protect_state_t enotc2Fg;		
    uint16_t u16otct2;
    uint16_t u16otcrt2;
    en_protect_state_t enotc3Fg;		
    uint16_t u16otct3;	
    uint16_t u16otcrt3;

    en_protect_state_t enutc1Fg;	
    uint16_t u16utct1;	
    uint16_t u16utcrt1;
    en_protect_state_t enutc2Fg;		
    uint16_t u16utct2;
    uint16_t u16utcrt2;
    en_protect_state_t enutc3Fg;		
    uint16_t u16utct3;
    uint16_t u16utcrt3;
		
    en_protect_state_t enotd1Fg;	
    uint16_t u16otdt1;	
    uint16_t u16otdrt1;
    en_protect_state_t enotd2Fg;		
    uint16_t u16otdt2;	
    uint16_t u16otdrt2;
    en_protect_state_t enotd3Fg;		
    uint16_t u16otdt3;		
    uint16_t u16otdrt3;

    en_protect_state_t enutd1Fg;
    uint16_t u16utdt1;	
    uint16_t u16utdrt1;
    en_protect_state_t enutd2Fg;		
    uint16_t u16utdt2;
    uint16_t u16utdrt2;
    en_protect_state_t enutd3Fg;		
    uint16_t u16utdt3;		
    uint16_t u16utdrt3;

    en_protect_state_t enotcdm1Fg;
    uint16_t u16otcdmt1;		
    uint16_t u16otcdmrt1;
    en_protect_state_t enotcdm2Fg;		
    uint16_t u16otcdmt2;	
    uint16_t u16otcdmrt2;
    en_protect_state_t enotcdm3Fg;		
    uint16_t u16otcdmt3;	
    uint16_t u16otcdmrt3;

    en_protect_state_t enutcdm1Fg;
    uint16_t u16utcdmt1;	
    uint16_t u16utcdmrt1;
    en_protect_state_t enutcdm2Fg;		
    uint16_t u16utcdmt2;		
    uint16_t u16utcdmrt2;
    en_protect_state_t enutcdm3Fg;		
    uint16_t u16utcdmt3;	
    uint16_t u16utcdmrt3;
		
    en_protect_state_t enotamb1Fg;
    uint16_t u16otambt1;	
    uint16_t u16otambrt1;
    en_protect_state_t enotamb2Fg;		
    uint16_t u16otambt2;
    uint16_t u16otambrt2;
    en_protect_state_t enotamb3Fg;		
    uint16_t u16otambt3;		
    uint16_t u16otambrt3;

    en_protect_state_t enutamb1Fg;
    uint16_t u16utambt1;	
    uint16_t u16utambrt1;
    en_protect_state_t enutamb2Fg;		
    uint16_t u16utambt2;
    uint16_t u16utambrt2;
    en_protect_state_t enutamb3Fg;		
    uint16_t u16utambt3;	
    uint16_t u16utambrt3;		

    en_protect_state_t endiffvol1Fg;
    uint16_t u16diffvolt1;	
    uint16_t u16diffvolrt1;
    en_protect_state_t endiffvol2Fg;		
    uint16_t u16diffvolt2;	
    uint16_t u16diffvolrt2;
    en_protect_state_t endiffvol3Fg;		
    uint16_t u16diffvolt3;	
    uint16_t u16diffvolrt3;
		
    en_protect_state_t endifftemp1Fg;
    uint16_t u16difftempt1;	
    uint16_t u16difftemprt1;
    en_protect_state_t endifftemp2Fg;		
    uint16_t u16difftempt2;	
    uint16_t u16difftemprt2;
    en_protect_state_t endifftemp3Fg;		
    uint16_t u16difftempt3;	
    uint16_t u16difftemprt3;	

    en_protect_state_t ensoclow1Fg;
    uint16_t u16soclowt1;	
    uint16_t u16soclowrt1;
    en_protect_state_t ensoclow2Fg;		
    uint16_t u16soclowt2;	
    uint16_t u16soclowrt2;
    en_protect_state_t ensoclow3Fg;		
    uint16_t u16soclowt3;	
    uint16_t u16soclowrt3;
		
    en_protect_state_t enline3Fg;		
    uint16_t u16linet3;
		uint16_t u16linert3;
		
		en_protect_state_t enfullchgFg;
		uint16_t fullchgrt;				
} stc_protect_var_t;

//----------------------------------------------------------------------------------------
// @Export global Variables declare in the module
extern stc_protect_var_t  g_stcProtectVar;

//----------------------------------------------------------------------------------------
// @Export declaration of functions in the module
void app_protect_init(void);
void app_protect_check(void);

#endif

// =======================================================================================
// End of file.
// =======================================================================================
